import { inRange, sleep } from 'ut2';
// import ImageBg from '../../public/1bg@2x.6e072926.jpg';
// import ImagePuzzle from '../../public/下载.png';
// console.log(ImageBg);
import ImageBg from './下载.png';
console.log(ImageBg);

export const getCaptcha = async () => {
  await sleep();
  return {
    bgUrl: 'https://caijf.github.io/rc-slider-captcha/static/1bg@2x.6e072926.jpg',
    puzzleUrl: ImageBg
  };
};

export const verifyCaptcha = async (data) => {
  await sleep();
  // value is 90±5
  if (data && inRange(data.x, 85, 95)) {
    return Promise.resolve();
  }
  return Promise.reject();
};